package com.shoplink.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup.LayoutParams;
import android.widget.ImageView;

public class FocusView extends ImageView {
	private int w;
	private int h;
	private View alphaView;

	public View getAlphaView() {
		return alphaView;
	}

	@Override
	public void bringToFront() {
		if (alphaView != null) {
			alphaView.bringToFront();
		}
		super.bringToFront();
	}

	@Override
	public void setVisibility(int visibility) {
		if (visibility != View.VISIBLE) {
			if (alphaView != null) {
				alphaView.setAlpha(0f);
			}
		}
		super.setVisibility(visibility);
	}

	public void setAlphaView(View alphaView) {
		this.alphaView = alphaView;
	}

	public int getW() {
		return w;
	}

	public void setW(int mWidth) {
		this.w = mWidth;
		LayoutParams layoutParams = getLayoutParams();
		layoutParams.width = mWidth;
		setLayoutParams(layoutParams);
	}

	public int getH() {
		return h;
	}

	public void setH(int mHeight) {
		this.h = mHeight;
		LayoutParams layoutParams = getLayoutParams();
		layoutParams.height = mHeight;
		setLayoutParams(layoutParams);
	}

	public FocusView(Context context) {
		super(context);
	}

	public FocusView(Context context, AttributeSet attrs) {
		super(context, attrs);
	}

}
